#ifndef MUCMAS_USER_INC_FLASH_H
#define MUCMAS_USER_INC_FLASH_H

#include "stm32f1xx_hal.h" 
#include "stm32f1xx_hal_flash.h"

#define FLASH_PAGE_0   0x08000000
#define FLASH_PAGE_1   0x08000400
#define FLASH_PAGE_2   0x08000800
#define FLASH_PAGE_3   0x08000C00
#define FLASH_PAGE_4   0x08001000
#define FLASH_PAGE_5   0x08001400
#define FLASH_PAGE_6   0x08001800
#define FLASH_PAGE_7   0x08001C00
#define FLASH_PAGE_8   0x08002000
#define FLASH_PAGE_9   0x08002400
#define FLASH_PAGE_10  0x08002800
#define FLASH_PAGE_11  0x08002C00
#define FLASH_PAGE_12  0x08003000
#define FLASH_PAGE_13  0x08003400
#define FLASH_PAGE_14  0x08003800
#define FLASH_PAGE_15  0x08003C00
#define FLASH_PAGE_16  0x08004000
#define FLASH_PAGE_17  0x08004400
#define FLASH_PAGE_18  0x08004800
#define FLASH_PAGE_19  0x08004C00
#define FLASH_PAGE_20  0x08005000
#define FLASH_PAGE_21  0x08005400
#define FLASH_PAGE_22  0x08005800
#define FLASH_PAGE_23  0x08005C00
#define FLASH_PAGE_24  0x08006000
#define FLASH_PAGE_25  0x08006400
#define FLASH_PAGE_26  0x08006800
#define FLASH_PAGE_27  0x08006C00
#define FLASH_PAGE_28  0x08007000
#define FLASH_PAGE_29  0x08007400
#define FLASH_PAGE_30  0x08007800
#define FLASH_PAGE_31  0x08007C00
#define FLASH_PAGE_32  0x08008000
#define FLASH_PAGE_33  0x08008400
#define FLASH_PAGE_34  0x08008800
#define FLASH_PAGE_35  0x08008C00
#define FLASH_PAGE_36  0x08009000
#define FLASH_PAGE_37  0x08009400
#define FLASH_PAGE_38  0x08009800
#define FLASH_PAGE_39  0x08009C00
#define FLASH_PAGE_40  0x0800A000
#define FLASH_PAGE_41  0x0800A400
#define FLASH_PAGE_42  0x0800A800
#define FLASH_PAGE_43  0x0800AC00
#define FLASH_PAGE_44  0x0800B000
#define FLASH_PAGE_45  0x0800B400
#define FLASH_PAGE_46  0x0800B800
#define FLASH_PAGE_47  0x0800BC00
#define FLASH_PAGE_48  0x0800C000
#define FLASH_PAGE_49  0x0800C400
#define FLASH_PAGE_50  0x0800C800
#define FLASH_PAGE_51  0x0800CC00
#define FLASH_PAGE_52  0x0800D000
#define FLASH_PAGE_53  0x0800D400
#define FLASH_PAGE_54  0x0800D800
#define FLASH_PAGE_55  0x0800DC00
#define FLASH_PAGE_56  0x0800E000
#define FLASH_PAGE_57  0x0800E400
#define FLASH_PAGE_58  0x0800E800
#define FLASH_PAGE_59  0x0800EC00
#define FLASH_PAGE_60  0x0800F000
#define FLASH_PAGE_61  0x0800F400
#define FLASH_PAGE_62  0x0800F800
#define FLASH_PAGE_63  0x0800FC00
#define FLASH_PAGE_64  0x08010000
#define FLASH_PAGE_65  0x08010400
#define FLASH_PAGE_66  0x08010800
#define FLASH_PAGE_67  0x08010C00
#define FLASH_PAGE_68  0x08011000
#define FLASH_PAGE_69  0x08011400
#define FLASH_PAGE_70  0x08011800
#define FLASH_PAGE_71  0x08011C00
#define FLASH_PAGE_72  0x08012000
#define FLASH_PAGE_73  0x08012400
#define FLASH_PAGE_74  0x08012800
#define FLASH_PAGE_75  0x08012C00
#define FLASH_PAGE_76  0x08013000
#define FLASH_PAGE_77  0x08013400
#define FLASH_PAGE_78  0x08013800
#define FLASH_PAGE_79  0x08013C00
#define FLASH_PAGE_80  0x08014000
#define FLASH_PAGE_81  0x08014400
#define FLASH_PAGE_82  0x08014800
#define FLASH_PAGE_83  0x08014C00
#define FLASH_PAGE_84  0x08015000
#define FLASH_PAGE_85  0x08015400
#define FLASH_PAGE_86  0x08015800
#define FLASH_PAGE_87  0x08015C00
#define FLASH_PAGE_88  0x08016000
#define FLASH_PAGE_89  0x08016400
#define FLASH_PAGE_90  0x08016800
#define FLASH_PAGE_91  0x08016C00
#define FLASH_PAGE_92  0x08017000
#define FLASH_PAGE_93  0x08017400
#define FLASH_PAGE_94  0x08017800
#define FLASH_PAGE_95  0x08017C00
#define FLASH_PAGE_96  0x08018000
#define FLASH_PAGE_97  0x08018400
#define FLASH_PAGE_98  0x08018800
#define FLASH_PAGE_99  0x08018C00
#define FLASH_PAGE_100 0x08019000
#define FLASH_PAGE_101 0x08019400
#define FLASH_PAGE_102 0x08019800
#define FLASH_PAGE_103 0x08019C00
#define FLASH_PAGE_104 0x0801A000
#define FLASH_PAGE_105 0x0801A400
#define FLASH_PAGE_106 0x0801A800
#define FLASH_PAGE_107 0x0801AC00
#define FLASH_PAGE_108 0x0801B000
#define FLASH_PAGE_109 0x0801B400
#define FLASH_PAGE_110 0x0801B800
#define FLASH_PAGE_111 0x0801BC00
#define FLASH_PAGE_112 0x0801C000
#define FLASH_PAGE_113 0x0801C400
#define FLASH_PAGE_114 0x0801C800
#define FLASH_PAGE_115 0x0801CC00
#define FLASH_PAGE_116 0x0801D000
#define FLASH_PAGE_117 0x0801D400
#define FLASH_PAGE_118 0x0801D800
#define FLASH_PAGE_119 0x0801DC00
#define FLASH_PAGE_120 0x0801E000
#define FLASH_PAGE_121 0x0801E400
#define FLASH_PAGE_122 0x0801E800
#define FLASH_PAGE_123 0x0801EC00
#define FLASH_PAGE_124 0x0801F000
#define FLASH_PAGE_125 0x0801F400
#define FLASH_PAGE_126 0x0801F800
#define FLASH_PAGE_127 0x0801FC00

void Flash_Unlock(void);
void Flash_Erase(uint32_t addr);
void Flash_Write(uint32_t addr, uint16_t *data, uint16_t len);

#endif
